'''
converters
'''
from flask import Flask, url_for

from werkzeug.routing import BaseConverter

class MyIntConvert(BaseConverter):
    def __init__(self, url_map):
        super(MyIntConvert, self).__init__(url_map)
    
    def to_python(self, value):
        return int(value)
    
    def to_url(self, value):
        return value * 3

app = Flask(__name__)
app.url_map.converters['my_int'] = MyIntConvert
 
 
@app.route('/')
def hello_world():
    return 'hello world'
 
 
@app.route('/page/<my_int:num>')
def page(num):
    print(num)
    print(url_for('page', num='123'))
    return 'hello world'
 
 
if __name__ == '__main__':
    app.run(port=5000, debug=True)